<?php

namespace Modules\Visitor\Http\Controllers\Admin\V1;

use Illuminate\Http\Request;
use Illuminate\Routing\Controller;

use Auth;
use Validator;
use ThrowException;
use Modules\Visitor\Entities\Visitor;

class VisitorController extends Controller
{
    public function index(Request $req)
    {
        $rule = [
        ];
        Validator::make($req->all(), $rule)->fails() && ThrowException::BadRequest();

        $options = $req->all();

        // $options['order_by'] = ['id', 'desc'];

        $visitor = Visitor::getList($options);

        return $visitor->generateListResponse();
        return [
            'visitors' => $visitor->toArray()
        ];
    }
}
